/*
 * CS_REQ_FISHING_SUCCESS.cpp
 *
 *  Created on: 2013. 11. 29.
 *      Author: mega
 */

#include "../../User.h"
#include "../../Command.h"
#include "../../NLogic/Fishing.h"
#include "../../NLogic/Function.h"

namespace ProjectZ { namespace NCommand {

void Command::CS_REQ_FISHING_SUCCESS(User * pUser, ::Network::Packet * pPacket)
{
	PREPARE_PACKET;

	NLogic::Fishing * pFishing = pUser->GetFishing();
	if (NULL == pFishing)
	{
		PROCESSLOG("CS_REQ_FISHING_SUCCESS : pFishing is NULL!!");
		return;
	}

	int gold = pFishing->GetGoldFromFishing();

	::Network::Packet * pAck = ::Network::GETPACKETPOOL()->SEND_NEW();
	*pAck << static_cast<uint32_t>(gold);
	pAck->MakePacket(CMD_SC_REQ_FISHING_SUCCESS);
	pUser->Send(pAck);

	if (gold > 0) {
		NLogic::NFunction::ModifyGold(pUser, gold);
	}
}

} /*NCommand*/ } /*ProjectZ*/
